<template>
  <div class="home">
        <div class="title">
      <span>别</span><span>踩</span><span>白</span><span>块</span>
    </div>
    <div class="choose">
      <router-link to="/classic">
        <div>经典模式</div>
      </router-link>
      <router-link to="/arcade">
        <div>街机模式</div>
      </router-link>
      <router-link to="/extremeSpeed">
        <div>极速模式</div>
      </router-link>
      <router-link to="/limitTime">
        <div>限时模式</div>
      </router-link>
    </div>
    <div class="go my">
      <router-link to="/my">
        <span>个人中心</span>
        <img src="./../assets/my.png" alt="" />
      </router-link>
    </div>
    <div class="go">
      <router-link to="/number">
        <span>排行榜</span>
        <img src="./../assets/to.png" alt="" />
      </router-link>
    </div>
    <audio
      loop="true"
      autoplay
      src="./../assets/CMJ - 椿（纯音乐）.mp3"
      controls
    ></audio>
    <ra-gular></ra-gular>
  </div>
</template>

<script>
import raGular from "@/components/ragular.vue";

export default {
  data(){
    return{
      timer : null,
    }
  },
  components: {
    raGular,
  },
    mounted() {
    if(document.querySelectorAll(".home>.title>span").length >0){
        let num = 0;
        this.timer = setInterval(() => {
          num++;
          document.querySelectorAll(".home>.title>span")[num-1].className= 'activeA';
          if (num == 4) {
            clearInterval(this.timer)
          }
      }, 1000);
    }
  },
  beforeDestroy(){
    clearInterval(this.timer);
  }
};
</script>



<style lang="scss" scoped>
body,
html {
  margin: 0;
  position: relative;
  padding: 0;
}
.home {
  width: 100%;
    .title {
    margin:0px;
    width: 200px;
    margin: auto;
    span {
      display: inline-block;
      font-size: 30px;
      padding: 70px 5px 0px;
      transform: translateY(-120px);
      text-align: center;
    }
    .activeA {
      animation: fontAnimate 1.2s forwards;
    }
    @keyframes fontAnimate {
      from {
        transform: translateY(-100px);
      }
      to {
        transform: translateY(0);
      }
    }
  }
  .choose {
    display: flex;
    flex-wrap: wrap;
    width: 300px;
    margin: 90px auto;
    a {
      display: inline-block;
      text-decoration: none;
      width: 150px;
      height: 100px;
      font-size: 20px;
      line-height: 100px;
      color: black;
      div {
      }
      &:nth-child(1),
      &:nth-child(4) {
        color: white;
        background-color: black;
      }
    }
  }
  .go {
    background-color: black;
    width: 130px;
    height: 50px;
    border-radius: 0 30px 30px 0;
    line-height: 50px;
    margin-bottom: 20px;
    a {
      justify-content: space-around;
      display: flex;
      margin-right: 0px;
      img {
        width: 30px;
        transform: rotate(90deg);
      }
      span {
        color: white;
        display: inline-block;
        margin-left: 10px;
      }
    }
  }
  .my {
    background-color: #fff;
    border: 1px solid #d7dada;
    border-left: 0px;
    margin: 10px 0;
    margin-right: 0px;
    a {
      margin-right: 0px;

      img {
        transform: rotate(0deg);
        height: 40px;
        width: 40px;
        margin-top: 5px;
      }
      span {
        color: black;
        margin-left: 10px;
      }
    }
  }
  audio {
    visibility: hidden;
  }
}
</style>